/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.bash.carrep.ui.datasource;

import com.bash.carrep.dao.enties.CreditLevel;
import com.bash.carrep.dao.general.CRUD;
import com.vaadin.data.util.BeanItemContainer;
import java.io.Serializable;
import java.util.List;


/**
 *
 * @author bash
 */
public class CreditLevelContainer extends BeanItemContainer<CreditLevel> implements Serializable {

    public CreditLevelContainer() throws IllegalArgumentException {
        super(CreditLevel.class);
    }
    public static final Object[] NATURAL_COL_ORDER = new Object[]{"idcreditLevel", "description"};
    public static final String[] COL_HEADERS_ENGLISH = new String[]{"Code", "Description"};
    static CRUD crud = CRUD.getInstance();
    // static String query = "Select c.idcreditLevel , c.description  from CreditLevel c ";

    public static CreditLevelContainer getData() {

        CreditLevelContainer c = null;

        try {
            crud.start();
            c = new CreditLevelContainer();
            List<CreditLevel> list = crud.getAll(CreditLevel.class);

            //  List<CreditLevel> list = crud.getList(query);
            c.addAll(list);

        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            crud.stop();
        }

        return c;
    }
}
